package cn.o.feign.system.attachment.controller;

import cn.o.entity.base.Result;
import cn.o.entity.system.attachment.Attachment;
import cn.o.api.feign.controller.FeignController;
import cn.o.api.feign.service.FeignService;
import cn.o.feign.system.attachment.service.AttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description:
 * @Author: Zhou Chenyu
 * @Date: 2018/10/24
 * @Version: V1.0
 * @Modified By:
 * @Modified Date:
 * @Why:
 */
@RestController
@RequestMapping("/attachment")
public class AttachmentController extends FeignController<Attachment> {

    @Autowired
    private AttachmentService attachmentService;

    @Override
    public FeignService getService() {
        return attachmentService;
    }

    @RequestMapping(value = "/upload")
    public Result upload(HttpServletRequest request, HttpServletResponse response, MultipartFile file) {
        return attachmentService.upload(request, response, file);
    }

}
